using System;

namespace ShopPowerTemplate.Common.Validation
{
    public class RequiredTimeValidationControl : ShopPowerTemplate.Common.Validation.ValidationControl
    {
        public RequiredTimeValidationControl()
            : base()
        {
            ValidationMessage.Text = "* Required";
        }

        public override bool Validate()
        {
            Nullable<DateTime> timeToValidate = PropertyToValidate as Nullable<DateTime>;
            if (timeToValidate == null || timeToValidate.Equals(DateTime.MinValue))
            {
                ValidationMessage.Visibility = Windows.UI.Xaml.Visibility.Visible;
                return false;
            }
            else
            {
                ValidationMessage.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                return true;
            }
        }
    }
}
